﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GLDotNet
{
    public abstract class DisposableObject : IDisposable
    {
        public bool IsDisposed
        {
            get;
            private set;
        }

        ~DisposableObject()
        {
            this.Dispose(false);
        }

        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (disposing)
                this.DisposeManagedResources();

            this.DisposeUnmanagedResources();

            this.IsDisposed = true;
        }

        protected abstract void DisposeManagedResources();

        protected abstract void DisposeUnmanagedResources();
    }
}
